(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    const os = require('os');
    const osUtils = require('os-utils');
    const getCPUUsage = async () => {
        return new Promise((resolve, reject) => {
            osUtils.cpuUsage(function (currCPU) {
                const freeMem = os.freemem() / 1024 / 1024 / 1024;
                const totalMem = os.totalmem() / 1024 / 1024 / 1024;
                const data = {
                    cpuUsage: (currCPU * 100.0).toFixed(2) + '%',
                    freeMem: freeMem.toFixed(2) + 'G',
                    totalMem: totalMem.toFixed(2) + 'G',
                    usedMem: (totalMem - freeMem).toFixed(2) + 'G',
                    MemUsage: ((totalMem - freeMem) / totalMem * 100.0).toFixed(2) + '%'
                };
                resolve(data);
            });
        });
    };
    exports.default = getCPUUsage;
});
